<template>
  <h4>{{ a }}</h4>
  <button @click="a++">a++</button>
  <button @click="stop">停止监视</button>
</template>

<script lang="ts">
import { ref, watchEffect } from "vue";

export default {
  setup() {
    let a = ref(100);

    let stop = watchEffect(() => {
      console.log("a变了", a.value);
    });

    return { a, stop };
  },
};
</script>
<style></style>
